package com.marvels.financial.loan.dao;

import com.github.pagehelper.Page;
import com.marvels.financial.loan.dto.McfePaymentTransfetDetailDTO;
import com.marvels.financial.loan.dto.PaymentFlowConditionDTO;
import com.marvels.financial.loan.dto.PaymentFlowDetailDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface McfePaymentTransfetDetailDao {


	/**
	 * 插入代扣流水数据
	 * @param record
	 * @return
	 */
    int insertSelective(McfePaymentTransfetDetailDTO record);


    /**
     * 更新代扣流水数据
     * @param record
     * @return
     */
    int updateByPrimaryKeySelective(McfePaymentTransfetDetailDTO record);



    /**
     * 查询还款流水详情
     * @param conditionDTO
     * @return
     */
    public Page<PaymentFlowDetailDTO> selectPaymentFlow(PaymentFlowConditionDTO conditionDTO);

    /**
     * 查询统计金额
     * @param conditionDTO
     * @return
     */
    public PaymentFlowDetailDTO selectPaymentFlowAmountStatic(PaymentFlowConditionDTO conditionDTO);


    /**
     * 下载还款流水详情
     * @param conditionDTO
     * @return
     */
    public List<PaymentFlowDetailDTO> downPaymentFlow(PaymentFlowConditionDTO conditionDTO);


    /**
     * 根据loanId查询交易处理中的代扣流水信息
     * @param loanId
     * @return
     */
    public McfePaymentTransfetDetailDTO selectTradingByLoanId(@Param("loanId") String loanId);



    /**
     * 根据状态查询代扣流水信息详情
     * @param status
     * @return
     */
    public List<McfePaymentTransfetDetailDTO> selectByStatus(@Param("status") String status);



    /**
     * 更新任务批次号
     * @param batchName
     * @return
     */
    public int updateBatchName(@Param("batchName") String batchName);


    /**
     * 占用订单号
     * @param batchName
     * @param orderNumber
     * @return
     */
    public int occupationOrder(@Param("batchName") String batchName,@Param("orderNumber") String orderNumber);

    /**
     * 根据批次号查询代扣流水信息详情
     * @param batchName
     * @return
     */
    public List<McfePaymentTransfetDetailDTO> selectByBatchName(@Param("batchName") String batchName);



    /**
     * 根据订单号查询代扣流水信息
     * @param orderNo
     * @return
     */
    public McfePaymentTransfetDetailDTO selectByOrderNo(@Param("orderNo") String orderNo);


    /**
     * 通过请求编号查询代扣记录
     * @param requestNo
     * @return
     */
    public McfePaymentTransfetDetailDTO selectByReqNo(@Param("requestNo") String requestNo);


    /**
     * 通过withholdCode查询详情表中处于处理中状态的条数
     * @param withholdCode
     * @return
     */
    public int countDealingByWithholdCode(@Param("withholdCode") String withholdCode);


    /**
     * 根据loanId,扣款类别查询代扣详情
     * @param loanId
     * @param withholdCategory  扣款类别 1 扣还款计划金额  2 扣展期费
     * @return
     */
    public List<McfePaymentTransfetDetailDTO> list(@Param("loanId") String loanId,@Param("withholdCategory") String withholdCategory);
}
